/*
 * Copyright rgil2010
 * All rights reserved
 */

package com.test.jdbc.connection;

import com.test.appli.mysql.names.Names;
import com.test.jdbc.Def;
import java.sql.ResultSet;

/**
 *
 * @author user
 */
public class ConAddRegUsrScr extends ConAddRegUsrAbs{
    public ConAddRegUsrScr() throws Exception{
        super();
    }

    @Override
    public boolean doJob()
            throws Exception {

        this._dbConnection_.connect("", "root", "0");
        this._dbConnection_.executeUpdate(Def.useDB(Names.db));
        this._dbConnection_.executeQuerry(Def.countElements(Names.tableUsr));
        ResultSet result = this._dbConnection_.getResult();
        Integer intLastId = 0;
        while(result.next())
        {
            intLastId = result.getInt(1);
        }
        intLastId++;
        String strId = intLastId.toString();

        String strCommand = Def.insertIntoTable(Names.tableUsr) +
            Def.addField(strId) +
            Def.addField(strIdentiteNom_) +
            Def.addField(strIdentitePrenom1_) +
            Def.addField(strIdentitePrenom2_) +
            Def.addField(strIdentitePrenom3_) +
            Def.addField("scr") +
            Def.addField(strIdentiteDateNaissance_) +
            Def.addField(strIdentiteSexe_) +
            Def.addField(strPersonnelMail_) +
            Def.addField(strTravailMail_) +
            Def.addField(strPersonnelFixe_) +
            Def.addField(strTravailFixe_) +
            Def.addField(strPersonnelPortable_) +
            Def.addField(strTravailPortable_) +
            Def.addField(strAdresseVoie_) +
            Def.addField(strAdresseNumero_) +
            Def.addField(strAdresseLigne1_) +
            Def.addField(strAdresseLigne2_) +
            Def.addField(strAdresseCode_) +
            Def.addField(strAdresseVille_) +
            Def.addField(strAdressePays_) +
            Def.addField(strLogin_) +
            Def.addLastField(strPassword_);
        this._dbConnection_.executeUpdate(strCommand);
        this._dbConnection_.disconnect();
        return true;
        
    }

}
